@extends('layouts.app')

@section('content')
        <div class="header">
            <ul class="breadcrumb">
                <li><i class="fa fa-fw fa-cog"></i>UK管理</li>
                <li class="active"><a href="">企业UK列表</a> </li>
            </ul>
        </div>
        <div class="main-content">
            <div class="btn-toolbar list-toolbar">
                <form class="form-inline  text-center center-block" style="margin-top:0px;" method="post">
                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                    <span class="btn-default" type="button">企业名称</span>
                    <input class="input-xlarge form-control mg_b5" placeholder="企业名称" type="text" name="unit_name" value="">
                    <button class="btn btn-primary mg_b5" type="submit"><i class="fa fa-search"></i>搜索</button>
                </form>
                <a href="{{url('admin/uk/add')}}" class="easyui-linkbutton" iconCls="icon-add">UK初始化</a>
                <div class="form-all">
                    <table class="table table-form table-striped table-bordered table-condensed">
                        <thead>
                        <tr>
                            <th width="80">序号</th>
                            <th>key_id</th>
                            <th>用户名</th>
                            <th>状态</th>
                            <th>企业名称</th>
                            <th>市</th>
                            <th>区</th>
                            <th>派出所</th>
                            <th>激活时间</th>
                            <th>绑定时间</th>
                            <th>到期时间</th>
                            {{--<th>操作</th>--}}
                        </tr>
                        </thead>
                        <tbody>
                        @foreach ($res as $key=>$re)
                            <tr>
                                <td>{{ $key+1 }}</td>
                                <td>{{ $re->key_id }}</td>
                                <td>{{ $re->username }}</td>
                                <td>
                                    @if($re->status == '1')已绑定
                                    @elseif($re->status == '2')未绑定
                                    @endif
                                </td>
                                <td>{{ $re->unit_name }}</td>
                                <td>{{ getValue($re->city,'area','id','name') }}</td>
                                <td>{{ getValue($re->area,'area','id','name') }}</td>
                                <td>{{ getValue($re->org_id,'area','id','name') }}</td>
                                <td>{{ $re->created_at }}</td>
                                <td>{{ $re->start_time }}</td>
                                <td>{{ $re->end_time }}</td>
                                {{--<td>
                                    <a href="{{url('admin/user/edit',$re->id)}}" class="easyui-linkbutton" iconCls="icon-edit" plain="true">编辑</a>
                                </td>--}}
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                </div>
                <span>共{{$count}}条数据</span>
                <ul class="pagination pull-right">
                    {{ $res->render() }}
                </ul>
            </div>
        </div>

    <script type="text/javascript">
        function check() {
            $('#search_form').submit();
        }

        $('.del').click(function(){
            var i=window.confirm("确认删除该条数据？");
            if(i==0){
                return false;
            }
        });
    </script>
        <script>
            $(document).ready(function(){
                var winHeight =  window.screen.height;
                var winWidth = 	window.screen.width;
                if(winWidth == 1024){
                    $('#taby').css('height',465+'px');
                    $('#taby').find('iframe').css('height',436+'px');
                }else if(winWidth == 1280){
                    $('#taby').css('height',465+'px');
                    $('#taby').find('iframe').css('height',436+'px');
                }else if(winWidth == 1366){
                    $('#taby').css('height',465+'px'); $('#taby').find('iframe').css('min-height',436+'px');
                }else if(winWidth == 1920){
                    $('#taby').css('height',625+'px');
                    $('#taby').find('iframe').css('min-height',596+'px');
                }else{
                    $('#taby').css('height',465+'px');
                    $('#taby').find('iframe').css('min-height',436+'px');
                }
            })

            function load_city_data_from_menu($id){
                var url = "{{url('admin/uk/index')}}"+"/1/"+$id;
                window.location.href = url;
            }

            function load_area_data_from_menu($id){
                var url = "{{url('admin/uk/index')}}"+"/2/"+$id;
                window.location.href = url;
            }
            function load_org_data_from_menu($id){
                var url = "{{url('admin/uk/index')}}"+"/3/"+$id;
                window.location.href = url;
            }
        </script>
@stop

